from core.basehandler import BaseHandler
from core.room import Room
from core.action import Action
from core.support import set_cutscene

class restroom(Room):
    def __init__(self, room_id):
        Room.__init__(self, room_id)    # do basic initialization for every room
        
        
        # build list of actions
        self.add_action(dancefloor)
        self.add_action(wait)
        self.add_action(enterladies)
    
    # return description of room.
    def get_description(self):
        return "The men's room is occupied. The ladies room door is cracked. Do you choose to wait for the men's room to become vacant or enter the ladies room?"
    
    # return image of room
    def get_image(self):
        return 'restroom.jpg'


class RestroomHandler(BaseHandler):
    
    # return class to use to create a new instance of this room
    def get_room_class(self):
        return restroom

# define actions for this room

class dancefloor(Action):
    def __init__(self):
        Action.__init__(self, "dancefloor")    # do basic initialization for every action
    
    # return description of action (used in label on webpage)
    def get_description(self):
        return "Go to the Dance Floor"
    
    # return id of room to enter when action is complete
    def get_destination(self):
        return 'dancefloor'
    
    def do_action(self,game,room,request):
        if game.get_player().inventory.has_key("crab cake"):
            game.get_player().inventory["crab cake"].been_in_bathroom = True
        return
    
    # return http method to use when user clicks on this action
    # use "get" if just moving to another room.  if changing something
    # like the state of an inventory item or room then use "post"
    def get_method(self):
        return "get"


class wait(Action):
    def __init__(self):
        Action.__init__(self, "Wait for Men's Room")    # do basic initialization for every action
    
    # return description of action (used in label on webpage)
    def get_description(self):
        return "Wait for the Men's Room"
    
    # return id of room to enter when action is complete
    def get_destination(self):
        return 'restroom2'
    # TEXT FOR WINNING CHALLENGE:  "While waiting, a hot bridesmaid sits on the bench next to you and starts removing her peep-toe heels. You make impenetrable eye contact. She says, 'Ahh, that feels better. You're a great dancer!' Now you have a choice to make. Do you flirt with the hot bridesmaid, or do you enter the men's bathroom that just became vacant?")

    def do_action(self,game,room,request):
        if game.get_player().inventory.has_key("crab cake"):
            game.get_player().inventory["crab cake"].been_in_bathroom = True
        set_cutscene("You decided to wait...")
        #self.usable = False
        return

class enterladies(Action):
    def __init__(self):
        Action.__init__(self, "Enter Ladies Room")    # do basic initialization for every action
    
    # return description of action (used in label on webpage)
    def get_description(self):
        return "Enter the Ladies Room"
    
    # return id of room to enter when action is complete
    def get_destination(self):
        return 'restroomladies'
    
    def do_action(self,game,room,request):
        if game.get_player().inventory.has_key("crab cake"):
            game.get_player().inventory["crab cake"].been_in_bathroom = True
        set_cutscene("You decided to enter the ladies room...")
        self.usable = False
        return